package com.lyf.common.domain;


import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @author yangdong
 * @since 2020/10/18 21:22
 */
@Data
public class BasePageQuery implements Serializable {
    private static int DEFAULT_MAX_SIZE = 200;

    @ApiModelProperty(value = "页码",example = "1")
    public Integer pageNum = 1;
    @ApiModelProperty(value = "数量",example = "10")
    public Integer pageSize = 10;

    public BasePageQuery(){
        if (this.pageNum == null || this.pageNum <= 0){
            this.pageNum = 1;
        }
        if (this.pageSize == null || this.pageSize <= 0){
            this.pageSize = 10;
        }
        if (this.pageSize > DEFAULT_MAX_SIZE){
            this.pageSize = DEFAULT_MAX_SIZE;
        }
        if (this.pageSize <=0){
            this.pageSize = 10;
        }
    }
}
